import React, { PureComponent } from 'react'
import { Navigate } from 'react-router-dom'

export default class Login extends PureComponent {
  constructor(props) {
    super(props)

    this.state = {
      isLogin: true
    }
  }
  
  login() {
    this.setState({ isLogin: false })
  }

  render() {
    const { isLogin } = this.state
    
    return (
      <div>
        <h3>Login Page</h3>
        {isLogin ? (<button onClick={e => this.login()}>登录</button>) : 
                    <Navigate to='/home'/>}
      </div>
    )
  }
}
